﻿using System;
using System.Collections.Generic;
using System.Text;

namespace GMusicBox.Core.Setting
{
    public class StandardSetting
    {
        public static Settings Data { get; set; }
        public static string FileName { get { return Settings.SettingSavePath + "\\Config\\Configs\\Config.xml"; } }
        public static void Update() { Data = new Settings(FileName); }
        public static void Save() { Data.WriteAllSettings(FileName); }

        public static bool AutoStart
        {
            get
            {
                string data = Data["AutoStart"];
                if (data == "")
                    return false;
                else return bool.Parse(data);
            }
            set { Data["AutoStart"] = value.ToString(); }
        }

        public static int CacheMax
        {
            get
            {
                string data = Data["CacheMax"];
                if (data == "")
                    return 1024;
                else return int.Parse(data);
            }
            set { Data["CacheMax"] = value.ToString(); }
        }

        public static string CachePath
        {
            get
            {
                string data = Data["CachePath"];
                if (data == "")
                    return "\\Cache\\";
                else return data;
            }
            set { Data["CachePath"] = value; }
        }

        public static int CloseEvent
        {
            get
            {
                string data = Data["CloseEvent"];
                if (data == "")
                    return 0;
                else return int.Parse(data);
            }
            set { Data["CloseEvent"] = value.ToString(); }
        }

        public static bool ExpanderAnimation
        {
            get
            {
                string data = Data["ExpanderAnimation"];
                if (data == "")
                    return true;
                else return bool.Parse(data);
            }
            set { Data["ExpanderAnimation"] = value.ToString(); }
        }

        public static bool HotKey
        {
            get
            {
                string data = Data["HotKey"];
                if (data == "")
                    return true;
                else return bool.Parse(data);
            }
            set { Data["HotKey"] = value.ToString(); }
        }

        public static string HotKeys
        {
            get
            {
                string data = Data["HotKeys"];
                if (data == "")
                    return "True,False,True,88|True,False,True,116|True,False,True,37|True,False,True,39|True,False,True,83|True,False,True,38|True,False,True,40";
                else return data;
            }
            set { Data["HotKeys"] = value; }
        }

        public static bool MinimizeToTray
        {
            get
            {
                string data = Data["MinimizeToTray"];
                if (data == "")
                    return true;
                else return bool.Parse(data);
            }
            set { Data["MinimizeToTray"] = value.ToString(); }
        }

        public static bool MultimediaKeyboard
        {
            get
            {
                string data = Data["MultimediaKeyboard"];
                if (data == "")
                    return true;
                else return bool.Parse(data);
            }
            set { Data["MultimediaKeyboard"] = value.ToString(); }
        }

        public static string SaveLyric
        {
            get
            {
                string data = Data["SaveLyric"];
                if (data == "")
                    return "\\Cache\\Lyrics\\";
                else return data;
            }
            set { Data["SaveLyric"] = value; }
        }

        public static string SaveThumbnails
        {
            get
            {
                string data = Data["SaveThumbnails"];
                if (data == "")
                    return "\\Cache\\Thumbnails\\";
                else return data;
            }
            set { Data["SaveThumbnails"] = value; }
        }

        public static bool ShowAd
        {
            get
            {
                string data = Data["ShowAd"];
                if (data == "")
                    return false;
                else return bool.Parse(data);
            }
            set { Data["ShowAd"] = value.ToString(); }
        }

        public static bool ShowNowPlaying
        {
            get
            {
                string data = Data["ShowNowPlaying"];
                if (data == "")
                    return true;
                else return bool.Parse(data);
            }
            set { Data["ShowNowPlaying"] = value.ToString(); }
        }

        public static bool ShowWelcome
        {
            get
            {
                string data = Data["ShowWelcome"];
                if (data == "")
                    return true;
                else return bool.Parse(data);
            }
            set { Data["ShowWelcome"] = value.ToString(); }
        }

        public static bool Subtitle
        {
            get
            {
                string data = Data["Subtitle"];
                if (data == "")
                    return false;
                else return bool.Parse(data);
            }
            set { Data["Subtitle"] = value.ToString(); }
        }

        public static bool TopMost
        {
            get
            {
                string data = Data["TopMost"];
                if (data == "")
                    return false;
                else return bool.Parse(data);
            }
            set { Data["TopMost"] = value.ToString(); }
        }
    }
}
